import re
import logging
from odoo import fields, api, models, tools, _
from odoo.exceptions import UserError, ValidationError

_logger = logging.getLogger(__name__)

class RespondentMessage(models.Model):
    _name = 'respondent.message'
    _description = 'Respondent Message'

    user_id = fields.Many2one('res.users', string='被访人')
    # respondent_unit_id = fields.Many2one('respondent.unit', string='被访人单位')
    respondent_address_id = fields.Many2one('respondent.address', string='被访人单位地址')
    name = fields.Char(compute='_compute_name')

    def _compute_name(self):
        for rec in self:
            rec.name = str(rec.user_id.name) + '(' + str(rec.respondent_address_id.name) + ')'
